package com.tangweiliang;

import com.tangweiliang.group.TangweiliangSelectImport1;
import com.tangweiliang.group.TangweiliangSelectImport2;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @author :tangweiliang
 * @date : 2023/1/7 15:06
 * 未来的你会感谢现在努力的自己
 */
@SpringBootApplication
//@Import({TangweiliangSelectImport1.class,TangweiliangSelectImport2.class})
public class MyApplication {
    public static void main(String[] args) {
//        SpringApplication application = new SpringApplication(MyApplication.class);
//        application.setEnvironmentPrefix("tangweiliang");
//        ConfigurableApplicationContext applicationContext = application.run();
//        ConfigurableEnvironment environment = applicationContext.getEnvironment();
//        System.out.println(environment.getProperty("k5"));
        SpringApplication.run(MyApplication.class,args);
    }

//    @Bean
//    public CommandLineRunner commandLineRunner(){
//        return new CommandLineRunner() {
//            @Override
//            public void run(String... args) throws Exception {
//                for (String arg:args){
//                    System.out.println(arg);
//                }
//            }
//        };
//    }

//    @Bean
//    public ApplicationRunner applicationRunner(){
//        return new ApplicationRunner() {
//            @Override
//            public void run(ApplicationArguments args) throws Exception {
//                System.out.println(args.getNonOptionArgs());
//                System.out.println(args.getOptionNames());
//                System.out.println(args.getOptionValues("k1"));
//                for (String sourceArg : args.getSourceArgs()) {
//                    System.out.println(sourceArg);
//                }
//            }
//        };
//    }
}
